package com.hsav.kcxb.utils;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;

/**
 * Created by zhao on 2016/12/24.
 */

public class BitmapUtil {

    public static Bitmap createCircleImg(Paint paint,Bitmap source, int min) {
        paint.setAntiAlias(true);
        Bitmap targetBit = Bitmap.createBitmap(min, min, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(targetBit);
        canvas.drawCircle(min / 2, min / 2, min / 2, paint);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        canvas.drawBitmap(source,0,0,paint);
        return targetBit;
    }
}
